package com.raylu.gmalllogger.Controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.SuccessCallback;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileInputStream;

/**
 * Description:
 * <p>
 * Create by lucienoz on 2021/12/22.
 * Copyright © 2021 lucienoz. All rights reserved.
 */
@RestController
@Slf4j
public class LoggerController {

    @Autowired
    KafkaTemplate<String,String> kafkaTemplate;

    @RequestMapping("/applog")
    public String logger(@RequestParam("param") String param){
//        System.out.println(param);
        log.info(param);
        ListenableFuture<SendResult<String, String>> ods_base_log = kafkaTemplate.send("ODS_BASE_LOG", param);
        return "success";
    }

}
